<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="layout" content="main" />
<title>Create Record</title>
</head>
<body>
<div class="body">
	<h1>建立應出席人員</h1>
	<div class="activityInfo">
		${activity.name}
	</div>
	
	<g:form method="post">
		<g:hiddenField name="activity.id" value="${ activity.id }" />
		<g:textField name="uid" />
		<g:actionSubmit value="加入" action="uidSave" />
	</g:form>
	
	<g:if test="${flash.message}">
    	<div class="message">${flash.message}</div>
    </g:if>	
	
	或匯入
	<g:each var="s" in="${Sport.list()}">
		<g:link action="save" class="button" params="['activity.id':activity.id, 'sport.id':s.id, 'category.id':-1]">${s.name}</g:link>
	</g:each>
	<g:each var="c" in="${Vcategory.list()}">
		<g:link action="save" class="button" params="['activity.id':activity.id, 'sport.id':-1, 'category.id':c.id]">${c.name}</g:link>
	</g:each>
	<div>
	<table>
		<tr><td></td><td>name</td><td>category</td><td>sport</td></tr>
	<g:set var="count" value="0" />
	<g:each var="record" in="${activity.records}">
		<tr>
			<td>${ count = count.toInteger() + 1 }</td>
			<td>
				<g:link class="deletePerson" action="delete" params="['id':record.id, 'activity.id':activity.id]">${record.person.name}</g:link>
			</td>
			<td>
				<g:each var="category" in="${record.person.categoryTags}">
					${category.category.name}
				</g:each>
			</td>
			<td>
				<g:each var="sport" in="${record.person.sportTags}">
					${sport.sport.name}
				</g:each>
			</td>
		</tr>
	</g:each>
	</table>
	</div>
</div>
</body>
</html>